<template>
  <CardItem
    title="通用审批待处理"
    :num="num"
    :icon="icon"
    @goMore="goMore"
  />
</template>

<script>
import { message } from "ant-design-vue";
import {
  defineComponent,
  reactive,
  ref,
  computed,
  watch,
  toRaw,
  toRefs,
} from "vue";
import utils from "@/common/utils/utils";
import request from "@/common/utils/request";
import CardItem from "@/views/home/components/CardItem.vue";
export default defineComponent({
  name: "ApprovalCard",
  components: { CardItem },
  props: {

  },
  setup(props, context) {

    const state = reactive({
      num: 0,
      icon: utils.staticPath + `images/workbench/approval.jpg`,
    });

    const getData = () => {
      request
        .post("/work_approval", "/staff/approval/form/dataCenter", {
          page: 1,
          pageSize: 10,
          status: -1,
          type: 'todo',
        })
        .then((res) => {
          state.num = res.total;
        });
    };

    getData();

    const goMore = () => {
      window.microApp.forceDispatch({
        type: "SetMicroPages",
        microInfo: {
          microId: 'org_workbench_approval_dataCenter',
          app: 'workApproval',
          name: "通用审批",
          url: '/approval/dataCenter',
        }
      })
    };


    return {
      ...toRefs(state),
      goMore,
    };
  },
});


</script>

<style lang="less" scoped>

</style>
